#ifndef COMMON_TASK_H_
#define COMMON_TASK_H_
#include <string>
#include "taskthread.h"
#include <stdint.h>

namespace thread {

/*! \class Task
    \brief A Task base class
 *
 *  A Task base class works as a base class of command pattern
 *  For more information about command pattern, please visit:
 *  http://en.wikipedia.org/wiki/Command_pattern
 */
class Task
{
public:

  /**
   * virtual destructor for inheritance
   */
  virtual ~Task() { /* empty */}

  /**
   * Override this function to implement your specific logic
   * @param thread_context  thead's specific context
   * @param app_context    application specific context
   */
  virtual void Execute(
    TaskThread* thread_context,
    void*       app_context) = 0;

  /**
   * Release relative resource of this task
   * It's the User's responsibility to release
   * the resource
   */
  virtual void Release() = 0;
  
  /**
   * 
   * @return task info 
   */

  virtual std::string ToString(){ return "";};

  uint32_t thread_idx;
protected: 
  Task() { thread_idx = 0;
 /* empty */ }

};

}

#endif 

